#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>

#include "FileDownLoader.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();
    void getReplyFinished(QNetworkReply *);
    void loadImage();
    void on_downloadImage_clicked();

private:
    Ui::MainWindow *ui;
    QNetworkAccessManager *manage;
    //数据的转换
    QJsonObject getJsonObjectFromByteArray(const QByteArray);
    QByteArray  getByteArrayFromJsonObject(const QJsonObject &);
    QJsonObject getJsonObjectFromString(const QString);
    QString getStringFromJsonObject(const QJsonObject &);
    FileDownLoader *m_pImgCtrl;
};

#endif // MAINWINDOW_H
